<template>
    <div>
        <h1>添加</h1>
        <table>
            <tbody>
                <tr>
                    <td>会员编号</td>
                    <td><input  type="text" v-model="info.userCode"/></td>
                </tr>
                <tr>
                    <td>会员名称</td>
                    <td><input  type="text" v-model="info.name"/></td>
                </tr>
                <tr>
                    <td>联系方式</td>
                    <td><input  type="text" v-model="info.phone"/></td>
                </tr>
                <tr>
                    <td>身份证</td>
                    <td><input  type="text" v-model="info.code"/></td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td><input  type="radio" name="state" value="1" v-model="info.state"/>可用
                        <input  type="radio" name="state" value="0" v-model="info.state"/>冻结</td>
                </tr>
                <tr>
                    <td>积分</td>
                    <td><input  type="text" v-model="info.jifen"/></td>
                </tr>
                <tr>
                    <td>会员余额</td>
                    <td><input  type="text" v-model="info.moey"/></td>
                </tr>
                <tr>
                    <td>会员等级</td>
                    <td><input  type="text" v-model="info.levellID"/></td>
                </tr>
                <tr>
                    <td>会员头像</td>
                    <td><input  type="text" v-model="info.photo"/></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" class="btn btn-success" value="添加" @click="login"/></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>



<script setup lang="ts">
import {ref,reactive}from 'vue'
import axios from 'axios'
import { useRoute } from 'vue-router';


const router=useRoute();

let info=reactive({
    userCode:'',
    name:'',
    phone:'',
    code:'',
    state:0,
    jifen:'',
    moey:'',
    levellID:'',
    photo:''
})
const login=()=>{
    axios.post('https://localhost:7161/api/Zuser/Add',info)
    .then(res=>{
        if(res.data>0){
            alert('添加成功!');
            
        }
        else{
            alert('添加失败!');
        }
    })
}

</script>
